<template>
	<div class="ac_banner_info" :class="{ no_code_banner: !info.specialCode }">
		<p class="ac_type">{{ info.type == 5 ? "线上活动" : "线下活动" }}</p>
		<p class="ac_title">{{ info.title }}</p>
		<div class="ac_info_detail flex">
			<img
				class="ac_info_detail_item_img"
				src="https://res.metaera.hk/resources/assets/images/active/add_tu.svg"
			/>
			<div class="ac_info_detail_item">
				<p class="ac_info_detail_item_title">地点</p>
				<p class="ac_info_detail_item_text">{{ info.address }}</p>
			</div>
		</div>
		<div class="ac_info_detail flex">
			<img
				class="ac_info_detail_item_img"
				src="https://res.metaera.hk/resources/assets/images/active/time_tu.svg"
			/>
			<div class="ac_info_detail_item">
				<p class="ac_info_detail_item_title">时间</p>
				<p class="ac_info_detail_item_text"
					>{{ info.start_time }}({{ info.timeZone }})</p
				>
				<p class="ac_info_detail_item_text"
					>{{ info.end_time }}（{{ info.timeZone }})</p
				>
			</div>
		</div>
		<div class="ac_info_detail flex" v-if="info.specialCode">
			<img
				class="ac_info_detail_item_img"
				src="https://res.metaera.hk/resources/assets/images/active/code_tu.svg"
			/>
			<div class="ac_info_detail_item">
				<p class="ac_info_detail_item_title">邀请码</p>
				<p class="ac_info_detail_item_text code_box">
					<span class="ac_info_detail_item_text_code maincolor"
						>{{ info.specialCode }}
					</span>
					<img
						src="https://res.metaera.hk/resources/assets/images/active/copy_tu.svg"
						class="ac_info_detail_item_text_copy"
						@click.stop="copyCode(info.specialCode)"
					/>
				</p>
			</div>
		</div>
		<div class="ac_info_detail flex">
			<img
				class="ac_info_detail_item_img"
				src="https://res.metaera.hk/resources/assets/images/active/host_tu.svg"
			/>
			<div class="host_cohost">
				<div class="ac_info_detail_item">
					<p class="ac_info_detail_item_title">主办方</p>
					<div class="img_box flex">
						<div id="hostBox" class="img-box">
							<img
								id="hostImg"
								v-for="(item, ind) in hostArray"
								:key="ind"
								:src="item.pic"
							/>
							<!-- <img v-for="(item, ind) in hostArray" :key="ind" :src="item.pic" /> -->
							<!-- <img v-for="(item, ind) in hostArray" :key="ind" :src="item.pic" /> -->
							<!-- <img v-for="(item, ind) in hostArray" :key="ind" :src="item.pic" /> -->
							<!-- <img v-for="(item, ind) in hostArray" :key="ind" :src="item.pic" /> -->
							<!-- <img v-for="(item, ind) in hostArray" :key="ind" :src="item.pic" /> -->
							<!-- <img v-for="(item, ind) in hostArray" :key="ind" :src="item.pic" /> -->
						</div>
						<p class="point-box flex" v-if="hostArray.length > 7">
							<span></span><span></span><span></span>
						</p>
					</div>
				</div>
				<!-- v-if="coHostArray.length > 0"  -->
				<div class="cohost_item ac_info_detail_item">
					<p class="ac_info_detail_item_title">协办方</p>
					<div class="img_box flex">
						<div class="img-box">
							<!-- coHostArray -->
							<img
								v-for="(item, inde) in hostArray"
								:key="inde"
								:src="item.pic"
							/>
						</div>
						<p class="point-box flex" v-if="coHostArray.length > 7">
							<span></span><span></span><span></span>
						</p>
					</div>
				</div>
			</div>
		</div>
		<div class="ac_info_btn"
			>参加活动
			<img
				src="https://res.metaera.hk/resources/assets/images/active/arrow_right.svg"
		/></div>
	</div>
</template>
<script>
import clipboard from "clipboard";

export default {
	props: ["info"],
	data() {
		return {
			hostArray: [],
			coHostArray: [],
			hostShowMore: false,
			coHostShowMore: false,
		};
	},
	mounted() {
		// this.hostShowMore = this.isShowMore("");
	},
	methods: {
		isShowMore(idParent, idChild, length) {
			const parentWid = document.getElementById(idParent).offsetWidth;
			const childWid = document.getElementById(idChild).offsetWidth;
			return parentWid / childWid > length;
		},
		copyCode(code) {
			clipboard.copy(code);
			this.$message({ message: "复制成功", type: "success" });
		},
	},
	watch: {
		info: {
			handler(val) {
				console.log("123" + val);

				this.hostArray = JSON.parse(val.organizer);
				this.coHostArray = JSON.parse(val.host);
			},
			deep: true,
			immediate: true,
		},
	},
};
</script>

<style scoped>
.ac_banner_info {
	box-sizing: border-box;
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	/* width: 24%; */
	width: 295px;
	border-radius: 20px;
	padding: calc(100vw * 24 / 1440) calc(100vw * 15 / 1440) 0;
	background: #fff;
	z-index: 9;
}
.ac_type {
	font-family: AlibabaPuHuiTi;
	font-size: clamp(8px, calc(100vw * 14 / 1440), 14px);
	font-weight: normal;
	line-height: 1;
	display: flex;
	align-items: center;
	letter-spacing: 0em;
	font-variation-settings: "opsz" auto;
	/* 正文色/正文辅助色 */
	color: #767676;
}
.ac_title {
	padding: calc(100vw * 10 / 1440) 0;
	font-family: AlibabaPuHuiTi;
	font-size: clamp(14px, calc(100vw * 28 / 1440), 28px);
	font-weight: bold;
	line-height: clamp(20px, calc(100vw * 40 / 1440), 40px);
	letter-spacing: 0em;
	font-variation-settings: "opsz" auto;
	/* 正文色/正文色 */
	color: #1a1a1a;
}
.ac_info_detail {
	margin-top: calc(100vw * 15 / 1440);
	width: 100%;
	box-sizing: border-box;
}
.cohost_item {
	margin-top: calc(100vw * 10 / 1440);
}
.ac_info_detail_item {
	flex-grow: 1;
}
.ac_info_detail_item_img {
	width: 12px;
	height: 12px;
	margin-right: 5px;
}
.ac_info_detail_item_title,
.ac_info_detail_item_text {
	font-size: clamp(8px, calc(100vw * 14 / 1440), 20px);
	line-height: 1;
	/* 一级文字 */
	color: #333333;
}
.ac_info_detail_item_text {
	margin-top: calc(100vw * 10 / 1440);
}

.img_box {
	margin-top: calc(100vw * 10 / 1440);
	margin-left: -15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex-wrap: nowrap;
}

.img_box img {
	box-sizing: border-box;
	margin-left: 15px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 1px solid #333;
}

.point-box {
	align-items: center;
	margin-left: 2px;
}

.point-box span {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #333;
	margin: 0 3px;
}

.ac_info_btn {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: clamp(20px, calc(100vw * 26 / 1440), 26px);
	text-align: center;
	height: clamp(20px, calc(100vw * 50 / 1440), 50px);
	line-height: clamp(20px, calc(100vw * 50 / 1440), 50px);
	border-radius: 20px;
	border: 1.5px solid #333333;
	font-size: 18px;
	color: #333;
}
.ac_info_btn img {
	width: 16px;
	height: 16px;
	margin-left: 5px;
}

.point-box {
	margin-left: 6px;
}
.point-box span {
	width: 2px;
	height: 2px;
	border-radius: 50%;
	background: #333;
}
.no_code_banner .ac_info_detail_item_title,
.no_code_banner .ac_info_detail_item_text {
	/* font-size: clamp(10px, calc(100vw * 20 / 1440), 22px); */
	/* line-height: 1; */
}
.no_code_banner .ac_info_btn {
	margin-top: clamp(20px, calc(100vw * 36 / 1440), 36px);
}
</style>
